CREATE PROC uspSample
AS
BEGIN
SELECT * FROM SampleData
END
GO
sp_configure 'Show Advanced Options' , 1
GO
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries' , 1
GO
RECONFIGURE
GO
SELECT *
INTO NewTable
FROM OPENROWSET('SQLNCLI' , 'Server=(local;Trusted_Connection=yes;' , 'EXEC uspSample' )
AS
BEGIN
SELECT * FROM SampleData
END
GO
sp_configure 'Show Advanced Options' , 1
GO
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries' , 1
GO
RECONFIGURE
GO
SELECT *
INTO NewTable
FROM OPENROWSET('SQLNCLI' , 'Server=(local;Trusted_Connection=yes;' , 'EXEC uspSample' )